﻿using System.IO;
using System;
 
using Juego_Lp.Objects;
using Juego_Lp.Characters;
using System.Collections.Generic;
namespace Juego_Lp.World
{
    public class Map
    {
        /*ATRIBUTES*/
        private int limiteX;
        private int limiteY;
        private int numberCreatures;
        private int baseMoney;
        private int moneyAccumulated;
        private string description;
        private Celdas[][] tablero;            

        private List<Soldiers> listSoldiers;
        private List<Monster> listMonsters;

        /*------------------------------------------|BUILDERS|-------------------------------------------*/

        public Map() {
            
            limiteX = 60;
            limiteY = 30;
            tablero = new Celdas[limiteX][];
            for (int fil = 0; fil < limiteX; fil++)
                tablero[fil] = new Celdas[limiteY];
                        
            baseMoney = 500;
            numberCreatures = 20;
            listSoldiers = new List<Soldiers>();
            listMonsters = new List<Monster>();
            this.InicializaMapa();
        }

        /*------------------------------------------|METHODS|-------------------------------------------*/

        public void InicializaMapa()
        {
            for (int i = 0; i < limiteX; i++)
                for (int j = 0; j < limiteY; j++)
                    tablero[i][j]= new Celdas(i,j,' ');
        }

        public void reiniciarMapa()
        {
            for (int i = 0; i < limiteX; i++)
                for (int j = 0; j < limiteY; j++)
                    tablero[i][j].setTipoElemento(' ');
        }

        public void actualizarMapa(int x, int y, char n)
        {
            switch (n)
            {
                case '1': tablero[x][y].setTipoElemento('P'); break;
                case '2': tablero[x][y].setTipoElemento('B'); break;
                case '3': tablero[x][y].setTipoElemento('F'); break;
            }
                        
        }
        /*--------------------------------------|SETTERS & GETTERS|-------------------------------------*/
        public int getLimiteX()
        {
            return limiteX;
        }
        public void setLimiteX(int limiteX)
        {
            this.limiteX = limiteX;
        }
        public int getLimiteY()
        {
            return limiteY;
        }
        public int getMoneyAccumulated()
        {
            return moneyAccumulated;
        }
        public void setMoneyAccumulated(int moneyAccumulated)
        {
            this.moneyAccumulated = moneyAccumulated;
        }
        public void setLimiteY(int limiteY)
        {
            this.limiteX = limiteY;
        }
        public int getNumberCreature()
        {
            return numberCreatures;
        }
        public void setNumberCreatures(int numberCreatures)
        {
            this.numberCreatures = numberCreatures;
        }
        public int getBaseMoney()
        {
            return baseMoney;
        }
        public void setBaseMoney(int baseMoney)
        {
            this.baseMoney = baseMoney;
        }
        public string getDescription()
        {
            return description;
        }
        public void setDescription(string description)
        {
            this.description = description;
        }

        public Celdas getTablero(int fil, int col)
        {
            return tablero[fil][col]; //devuelve una Celdas del tablero
        }
        public void setTablero(Celdas Celdas)
        {
            this.tablero[1][1] = Celdas;
        }

        public List<Soldiers> getListsoldiers()
        {
            return this.listSoldiers; //devuelve una Celdas del tablero
        }
        public void setSoldiers(Soldiers asoldier)
        {
            this.listSoldiers.Add(asoldier);
        }


        /*-------------------------------------------|OTHERS|-------------------------------------------*/
        
        internal Celdas get(int x, int y)
        {
            throw new NotImplementedException();
        }

        internal bool existe(int x, int y)
        {
            throw new NotImplementedException();
        }

        internal void agregarposicion(string codbatallon, int nuevax, int nuevay)
        {
            throw new NotImplementedException();
        }

        internal int getposicionx(string p)
        {
            throw new NotImplementedException();
        }

        internal int getposiciony(string p)
        {
            throw new NotImplementedException();
        }

        internal void llenarbatallon(int nuevax, int nuevay, string codbatallon)
        {
            throw new NotImplementedException();
        }

        internal void quitarposicion(string codbatallon)
        {
            throw new NotImplementedException();
        }

        internal void vaciar(int x, int y)
        {
            throw new NotImplementedException();
        }

        


    }
}